import config from "@/config"
import http from "@/utils/request"

export default {
	pager: {
		url: `${config.API_URL}/admin/v1/employee/pager`,
		name: "分页列表",
		get: function (params) {
			return http.get(this.url, params);
		}
	},
	create: {
		url: `${config.API_URL}/admin/v1/employee/create`,
		name: "新增",
		post: function (data) {
			return http.post(this.url, data);
		}
	},
	detail: {
		url: `${config.API_URL}/admin/v1/employee/:serial/detail`,
		name: "查看详情",
		get: function (serial) {
			const uri = this.url.replace(':serial', serial);
			return http.get(uri);
		},
		delete: function (serial) {
			const uri = this.url.replace(':serial', serial);
			return http.delete(uri);
		}
	},
	batch: {
		url: `${config.API_URL}/admin/v1/employee/batch`,
		name: "批量导入",
		post: function (data) {
			return http.post(this.url, data);
		}
	},
	template: {
		url: `${config.API_URL}/admin/setup/employee-template`,
		name: "导入模板",
		get: function () {
			return http.get(this.url);
		},
	},
	list: {
		url: `${config.API_URL}/admin/v1/employee/list`,
		name: "筛选列表",
		get: function (params) {
			return http.get(this.url, params);
		}
	},

	/**
	 * 个人信息
	 */
	information: {
		pager: {
			url: `${config.API_URL}/admin/v1/employee/information/pager`,
			name: "分页列表",
			get: function (params) {
				return http.get(this.url, params);
			}
		},
		create: {
			url: `${config.API_URL}/admin/v1/employee/information/create`,
			name: "新增",
			post: function (data) {
				return http.post(this.url, data);
			}
		},
		detail: {
			url: `${config.API_URL}/admin/v1/employee/information/:serial/detail`,
			name: "详情",
			get: function (serial) {
				const uri = this.url.replace(':serial', serial);
				return http.get(uri);
			},
			delete: function (serial) {
				const uri = this.url.replace(':serial', serial);
				return http.delete(uri);
			}
		},
		exports: {
			url: `${config.API_URL}/admin/v1/employee/information/exports`,
			name: "一键导出",
			post: function (data) {
				return http.post(this.url, data);
			}
		},
	},

	/**
	 * 专项扣除
	 */
	exemption: {
		create: {
			url: `${config.API_URL}/admin/v1/employee/exemption/create`,
			name: "新增",
			post: function (data) {
				return http.post(this.url, data);
			}
		},
		detail: {
			url: `${config.API_URL}/admin/v1/employee/exemption/:serial/detail`,
			name: "详情",
			get: function (serial) {
				const uri = this.url.replace(':serial', serial);
				return http.get(uri);
			}
		}
	}
}